package com.nsgf.library.data.bean;

import androidx.annotation.ColorInt;

public class HomeDeviceOpeningBean {
    private String deviceName;
    private String deviceCode;
    private String value;
    private String status; // 状态: "运行" 或 "关闭"
    private String duration; // 持续时间: 如 "2h15min"

    @Override
    public String toString() {
        return this.facilityName; // 或者其他你想显示的属性
    }

    private String facilityCode;
    private String facilityName;
    private String facilityType;

    public String getFacilityCode() {
        return facilityCode;
    }

    public void setFacilityCode(String facilityCode) {
        this.facilityCode = facilityCode;
    }

    public String getFacilityName() {
        return facilityName;
    }

    public void setFacilityName(String facilityName) {
        this.facilityName = facilityName;
    }

    public String getFacilityType() {
        return facilityType;
    }

    public void setFacilityType(String facilityType) {
        this.facilityType = facilityType;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getDeviceCode() {
        return deviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    /**
     * 判断设备是否运行中
     */
    public boolean isRunning() {
        return "运行".equals(status) || "1".equals(value) || "open".equalsIgnoreCase(status);
    }

    /**
     * 获取格式化的状态文本（带括号）
     */
    public String getFormattedStatus() {
        if (status == null) {
            return "";
        }
        if (isRunning()) {
            return "(运行)";
        } else {
            return "(关闭)";
        }
    }

    /**
     * 获取状态文本颜色（用于DataBinding）
     */
    @ColorInt
    public int getStatusTextColor() {
        return isRunning() ? 0xFF219EFF : 0xFF9CA3AF; // 运行:蓝色, 关闭:灰色
    }
}
